package domain

import "boy-go/pkg/xstr"

type MetaVo struct {
	Title   string  `json:"title" form:"title"`     //设置该路由在侧边栏和面包屑中展示的名字
	Icon    *string `json:"icon" form:"icon"`       //设置该路由的图标，对应路径src/assets/icons/svg
	NoCache bool    `json:"noCache" form:"noCache"` //设置为true，则不会被 <keep-alive>缓存
	Link    *string `json:"link" form:"link"`       //内链地址（http(s)://开头）
}

func BuildMetaVo(title string, icon *string, noCache bool, link *string) *MetaVo {
	vo := &MetaVo{
		Title:   title,
		Icon:    icon,
		NoCache: noCache,
	}
	if link != nil && xstr.IsHttp(link) {
		vo.Link = link
	}
	return vo
}
